<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:86:"/data/www/html/web2017/public_html/../application/admin/view/article/shenhe_index.html";i:1501831560;s:79:"/data/www/html/web2017/public_html/../application/admin/view/public/header.html";i:1484102488;s:79:"/data/www/html/web2017/public_html/../application/admin/view/public/footer.html";i:1487735376;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo config('WEB_SITE_TITLE'); ?></title>
    <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/static/admin/css/animate.min.css" rel="stylesheet">
    <link href="/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/static/admin/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="/static/admin/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="/static/admin/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="/static/admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <style type="text/css">
    .long-tr th{
        text-align: center
    }
    .long-td td{
        text-align: center
    }
    </style>
</head>
<style>
    .ui-mask{
        width: 100%;height:100%;background: #000;
        position: absolute;top: 0px;height: 0px;z-index: 8000;
        opacity:0.4; filter: Alpha(opacity=40);
    }
    .link{text-align: right;line-height: 20px;padding-right: 40px;}

    .ui-dialog{
        width: 380px;height: auto;display: none;
        position: absolute;z-index: 9000;
        top: 0px;left: 0px;
        border: 1px solid #D5D5D5;background: #fff;
    }

    .ui-dialog a{text-decoration: none;}

    .ui-dialog-title{
        height: 48px;line-height: 48px; padding:0px 20px;color: #535353;font-size: 16px;
        border-bottom: 1px solid #efefef;background: #f5f5f5;
        cursor: move;
        user-select:none;
    }
    .ui-dialog-closebutton{
        width: 16px;height: 16px;display: block;
        position: absolute;top: 12px;right: 20px;
        background: url(/static/pc/image/close_def.png) no-repeat;cursor: pointer;

    }
    .ui-dialog-closebutton:hover{background:url(/static/pc/image/close_hov.png);}

    .ui-dialog-content{
        padding: 15px 20px;
    }
    .ui-dialog-pt15{
        padding-top: 15px;
    }
    .ui-dialog-l40{
        height: 40px;line-height: 40px;
        text-align: right;
    }

    .ui-dialog-input{
        width: 100%;height: 40px;
        margin: 0px;padding:0px;
        border: 1px solid #d5d5d5;
        font-size: 16px;color: #c1c1c1;
        text-indent: 25px;
        outline: none;
    }
    .ui-dialog-input-username{
        background: url(images/input_username.png) no-repeat 2px ;
    }

    .ui-dialog-input-password{
        background: url(images/input_password.png) no-repeat 2px ;
    }
    .ui-dialog-submit{
        width: 100%;height: 50px;background: #3b7ae3;border:none;font-size: 16px;color: #fff;
        outline: none;text-decoration: none;
        display: block;text-align: center;line-height: 50px;
    }
    .ui-dialog-submit:hover{
        background: #3f81b0;
    }

    .ui-mask{
        width: 100%;height:100%;background: #000;
        position: absolute;top: 0px;height: 0px;z-index: 8000;
        opacity:0.4; filter: Alpha(opacity=40);
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight" id="content">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>文章列表</h5>
        </div>


        <div class="ibox-content">


            <!--搜索框开始-->
            <div class="row">
                <div class="col-sm-3">
                    <A href="<?php echo url('article/shenhe_index',array('type'=>1)); ?>" class="btn btn-outline btn-primary">未审核</A>
                    <A href="<?php echo url('article/shenhe_index',array('type'=>2)); ?>" class="btn btn-outline btn-primary">已发布</A>
                    <A href="<?php echo url('article/shenhe_index',array('type'=>3)); ?>" class="btn btn-outline btn-primary">已驳回</A>
                    </div>

                <div class="col-sm-9">
                    <!--<div  class="col-sm-2" style="width: 100px">-->
                        <!--&lt;!&ndash;<div class="input-group" >&ndash;&gt;-->
                            <!--&lt;!&ndash;<a href="<?php echo url('add_article'); ?>"><button class="btn btn-outline btn-primary" type="button">添加文章</button></a>&ndash;&gt;-->
                        <!--&lt;!&ndash;</div>&ndash;&gt;-->
                    <!--</div>-->
                    <form name="admin_list_sea" class="form-search" method="post" action="<?php echo url('article/shenhe_index'); ?>">
                        <div class="col-sm-6">
                            <div class="input-group">
                                <input type="text" id="key" class="form-control" name="key" value="<?php echo $val; ?>" placeholder="输入需查询的文章名称" />
                                <span class="input-group-btn">
                                    <input type="hidden" name="type" value="<?php echo $type; ?>">
                                    <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
                                </span>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <!--搜索框结束-->
            <div class="hr-line-dashed"></div>
            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                        <tr class="long-tr">
                            <th width="3%">ID</th>
                            <th width="5%">所属机构</th>
                            <th width="5%">作者昵称</th>


                            <th width="15%">标题</th>
                            <th width="5%">所属分类</th>
                            <th width="5%">文章封面</th>

                            <th width="4%">关注数</th>
                            <th width="10%">提交时间</th>
                            <!--<th width="10%">更新时间</th>-->
                            <!--<th width="5%">状态</th>-->
                            <th width="5%">是否置顶</th>
                            <th width="5%">状态</th>
                            <th width="10%">操作</th>
                        </tr>
                        </thead>
                        <script id="list-template" type="text/html">
                            {{# for(var i=0;i<d.length;i++){  }}
                            <tr class="long-td"  id="ct{{d[i].id}}">
                                <td>{{d[i].id}}</td>

                                <td>{{d[i].instit_name}}</td>
                                <td>{{d[i].username}}</td>
                                <td>{{d[i].title}}</td>
                                <td>{{d[i].name}}</td>
                                <td><img src="/uploads/images/{{d[i].photo}}" style="height: 30px" onerror="this.src='/static/admin/images/no_img.jpg'"/></td>

                                <td>{{d[i].fans}}</td>
                                <td>{{d[i].create_time}}</td>


                                <td>
                                    {{# if(d[i].is_tui==1){ }}
                                    <a class="red" href="javascript:;" onclick="article_state({{d[i].id}});">
                                        <div id="zt{{d[i].id}}"><span class="label label-info">是</span></div>
                                    </a>
                                    {{# }else{ }}
                                    <a class="red" href="javascript:;" onclick="article_state({{d[i].id}});">
                                        <div id="zt{{d[i].id}}"><span class="label label-danger">否</span></div>
                                    </a>
                                    {{# } }}
                                </td>


                                <td id="st{{d[i].id}}">
                                    {{d[i].status1}}
                                </td>

                                <td>

                                    <a href="javascript:;" onclick="chuli({{d[i].id}})" class="btn btn-primary btn-xs btn-outline">
                                        <i class="fa fa-paste"></i> 处理</a>&nbsp;&nbsp;


                                    <a href="javascript:;" onclick="read_article({{d[i].id}})" class="btn btn-primary btn-xs btn-outline">
                                        <i class="fa fa-paste"></i> 查看内容</a>&nbsp;&nbsp;
                                    <!--<a href="javascript:;" onclick="del_article({{d[i].id}})" class="btn btn-danger btn-xs btn-outline">-->
                                        <!--<i class="fa fa-trash-o"></i> 删除</a>-->
                                </td>
                            </tr>
                            {{# } }}
                        </script>
                        <tbody id="list-content"></tbody>
                    </table>
                    <div id="AjaxPage" style="text-align:right;"></div>
                    <div style="text-align: right;">
                        共<?php echo $count; ?>条数据，<span id="allpage"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

<!-- 加载动画 -->
<div class="spiner-example">
    <div class="sk-spinner sk-spinner-three-bounce">
        <div class="sk-bounce1"></div>
        <div class="sk-bounce2"></div>
        <div class="sk-bounce3"></div>
    </div>
</div>

<div class="ui-mask" id="mask" onselectstart="return false" style="display: none; width: 1349px; height: 1100px;"></div>
<div class="ui-dialog" id="dialogMove" onselectstart="return false;" style="display: none;position: fixed; left:30%; top: 150px;">
    <div class="ui-dialog-title" id="dialogDrag" onselectstart="return false;">

        文章处理

        <a class="ui-dialog-closebutton" href="javascript:" onclick="hideDialog();"></a>

    </div>
    <div class="ui-dialog-content">

        <div class="ui-dialog-l40 ui-dialog-pt15">
            <select class="ui-dialog-input ui-dialog-input-password" name="result" id="result"  style="color: #000;">
                <option value="1" >通过审核</option>
                <option value="2" >驳回文章</option>
            </select>
        </div>
         <div class="ui-dialog-l40 ui-dialog-pt15" style="display: none;" id="notes">
                <input class="ui-dialog-input ui-dialog-input-password" type="input" name="note" id="note" placeholder="请填写备注" >
         </div>

        <div style="margin-top: 20px;">
            <input type="hidden"  name="id" id="article_id" value="">
            <a class="ui-dialog-submit" href="javascript:"  onclick="tijiao()" >处理</a>
        </div>

    </div>
</div>


<script src="__JS__/jquery.min.js?v=2.1.4"></script>
<script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
<script src="__JS__/content.min.js?v=1.0.0"></script>
<script src="__JS__/plugins/chosen/chosen.jquery.js"></script>
<script src="__JS__/plugins/iCheck/icheck.min.js"></script>
<script src="__JS__/plugins/layer/laydate/laydate.js"></script>
<script src="__JS__/plugins/switchery/switchery.js"></script><!--IOS开关样式-->
<script src="__JS__/jquery.form.js"></script>
<script src="__JS__/layer/layer.js"></script>
<script src="__JS__/laypage/laypage.js"></script>
<script src="__JS__/laytpl/laytpl.js"></script>
<script src="__JS__/lunhui.js"></script>
<script>
    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
</script>

<script type="text/javascript">



    Ajaxpage();

    function Ajaxpage(curr){
        var key=$('#key').val();
        var type='<?php echo $type; ?>';
        $.getJSON('<?php echo url("article/shenhe_index"); ?>', {
            page: curr || 1,key:key,type:type
        }, function(data){      //data是后台返回过来的JSON数据
            $(".spiner-example").css('display','none'); //数据加载完关闭动画
            if(data==''){
                $("#list-content").html('<td colspan="20" style="padding-top:10px;padding-bottom:10px;font-size:16px;text-align:center">暂无数据</td>');
            }else{

                console.log(data);

                var tpl = document.getElementById('list-template').innerHTML;
                laytpl(tpl).render(data, function(html){
                    document.getElementById('list-content').innerHTML = html;
                });
                laypage({
                    cont: $('#AjaxPage'),//容器。值支持id名、原生dom对象，jquery对象,
                    pages:'<?php echo $allpage; ?>',//总页数
                    skip: true,//是否开启跳页
                    skin: '#1AB5B7',//分页组件颜色
                    curr: curr || 1,
                    groups: 3,//连续显示分页数
                    jump: function(obj, first){
                        if(!first){
                            Ajaxpage(obj.curr)
                        }
                        $('#allpage').html('第'+ obj.curr +'页，共'+ obj.pages +'页');
                    }
                });
            }
        });
    }


    //编辑文章
    function read_article(id){
        location.href = '/admin/article/articleread/id/'+id+'.html';
    }

    //删除文章
    function del_article(id){
        lunhui.confirm(id,'<?php echo url("del_article"); ?>');
    }

    //文章状态
    function article_state(id){
        lunhui.status(id,'<?php echo url("article_tui_state"); ?>','是','否');
    }

    function article_status(id){
        lunhui.status(id,'<?php echo url("article_status"); ?>','已审核','未审核','zk');
    }

    function chuli(id){

       // $('.column').height($(window).height());
        $('#mask').css('display','block');
        $('#dialogMove').css('display','block');

        $('#article_id').val(id);



    }


    function hideDialog(){
        $('#mask').css('display','none');
        $('#dialogMove').css('display','none');
         $('#article_id').val('');
        $('#note').val('');
        $('#notes').css('display','none');
        $('#result').val(1);

    }

    $("select").change(function(){
        var a = $(this).val();
       if(a==2){
           $('#notes').css('display','block');
       }else{
           $('#notes').css('display','none');
       }
    });

    function tijiao(){

        id =  $('#article_id').val();
        note = $('#note').val();
        result = $('#result').val();

        if(result=='2'){
            if($.trim(note)==''){
                alert('驳回文章时请添加备注');
                return false;
            }
        }

//        console.log(id+'|'+result+'|'+note);

        $.post('<?php echo url("article/article_status"); ?>',
                {id:id,note:note,result:result},
                function(data){
                    if(data.code==1){
                        $('#mask').css('display','none');
                        $('#dialogMove').css('display','none');
                        $('#article_id').val('');
                        $('#note').val('');
                        $('#notes').css('display','none');
                        $('#result').val(1);
                        var ckds = '#st'+id;
                        if(result==1){
                            $(ckds).html('已发布');
                        }
                        if(result==2){
                            $(ckds).html('已驳回');

                            $('#ct'+id).remove();


                        }
                        layer.msg('处理成功', {icon: 1,time:1500,shade: 0.1}, function(index){
                            layer.close(index);
                        });
                    }else{
                        alert('操作异常');
                    }

                });
        return false;




    }



</script>
</body>
</html>